package com.teamclub.erp.scontrollers

import com.teamclub.erp.sforms.ProductBrandForm
import com.teamclub.erp.sservices.ProductBrandService
import com.teamclub.util.libs.Eithers
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.{PostMapping, RequestBody, RequestMapping, RestController}

/**
  * Created by ilkkzm on 17-9-22.
  */
@RestController("com.teamclub.erp.scontrollers.ProductBrandController")
@RequestMapping(Array("/erp"))
class ProductBrandController {
  @Autowired
  var service: ProductBrandService = _
  @PostMapping(Array("productbrandlist"))
  def list(@RequestBody form: ProductBrandForm) = {
    Eithers.toJson(service.list(form))
  }
  @PostMapping(Array("productbrandadd"))
  def add(@RequestBody form: ProductBrandForm) = {
    Eithers.toJson(service.add(form))
  }
  @PostMapping(Array("productbranddel"))
  def del(@RequestBody form: ProductBrandForm) = {
    Eithers.toJson(service.del(form))
  }
}
